//
//  LGCollectionViewCell.m
//  LoveTravel
//
//  Created by MS on 16-1-21.
//  Copyright (c) 2016年 Lemon. All rights reserved.
//

#import "LGCollectionViewCell.h"
#import "ImageTitleView.h"
#import "UIImageView+WebCache.h"
@interface LGCollectionViewCell ()

@property (weak, nonatomic) IBOutlet ImageTitleView *itemView;


@end

@implementation LGCollectionViewCell


-(void)setCollectionItemData:(Collections_Model *)collectionItemData
{
    _collectionItemData = collectionItemData;
    
    [_itemView.imageView sd_setImageWithURL:[NSURL URLWithString:collectionItemData.bg_pic[0]]];
    _itemView.titleView.text = collectionItemData.title;
    _itemView.subTitleView.text = collectionItemData.sub_title;
}


+(instancetype)cellWithcollectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    NSString * className = NSStringFromClass([self class]);
    UINib *  nib = [UINib nibWithNibName:className bundle:nil];
    [collectionView registerNib:nib forCellWithReuseIdentifier:className];
    return [collectionView dequeueReusableCellWithReuseIdentifier:className forIndexPath:indexPath];
    
}


- (void)awakeFromNib {
    // Initialization code
    ImageTitleView * view = [ImageTitleView imageTitleViewWithXib];
    self.itemView = view;
    view.frame = self.bounds;
    [self addSubview:view];
}

@end
